package com.bric.prewarnFile;

import java.io.File;

import org.apache.log4j.Logger;

import com.bric.common.String_File;
import com.bric.util.StaticStr;

public class PrewarnFile extends Thread{
	private static final Logger log=Logger.getLogger(PrewarnFile.class);
	public File[] getPrewarnFiles(){
		log.info("获取预警文件列表");
		File[] files=null;
		File prewarnFile=new File(StaticStr.localFilePath+StaticStr.prewarnFilePath);
		if(prewarnFile.exists()&&prewarnFile.isDirectory()){
			files=prewarnFile.listFiles();
		}
		return files;
	}
	
	@Override
	public void run() {
		log.info("将预警模型的数据文件移动的线程开始执行...");
		new PrewarnFile().moveToWebApp();
	}

	private void moveToWebApp() {
		File[] files=getPrewarnFiles();
		if(null!=files){
			for(File f:files){
				String_File.file2file(f, StaticStr.chinaBricWebRoot);
			}
		}
	}
}
